<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <ul>
        <li>芈月</li>
        <li>子歇</li>
        <li>秦王</li>
    </ul>
    <script>
        let a="芈八子";
        let b;
        console.log(a,b);  //芈八子 undefined

        //let特点
        //1.没有预解析
        // console.log(c);   //报错
        // let c="伊利";

        //2.块级作用域
        let d=100;
        if(1==1){
            let d=20;
            console.log(d); //20
        }
        console.log(d);   //100

        var lis=document.querySelectorAll("li");
        for(let i=0;i<lis.length;i++){
            lis[i].onclick=function(){
                console.log(lis[i].innerText);
            }
        }

        //3.变量命名不可以重复，否则报错
        let e=30;
        // let e=10; //报错
        console.log(e);

        let addidas=10;
        function fn(){
            // console.log(addidas);//报错
            let addidas=20;
        }
        fn();
    </script>
</body>
</html>